<template>
    <layout-main v-if="hide" />
    <layout v-else />
</template>

<script setup lang="ts">
    import { computed } from "vue"
    import { useRouter } from "vue-router"
    import {
        useDialog,
        useMessage,
        useNotification,
        useLoadingBar,
    } from "naive-ui"

    import Layout from "@/layout/index.vue"
    import LayoutMain from "@/layout/components/Main.vue"
    import { systemName } from "@/utils/config"

    document.title = systemName

    window.$dialog = useDialog()
    window.$message = useMessage()
    window.$notification = useNotification()
    window.$loading = useLoadingBar()

    const router = useRouter()

    const hide = computed(() => {
        const meta = router.currentRoute.value.meta

        if (meta && meta.hasOwnProperty("hide")) {
            if (meta.hide) {
                return true
            }
        }

        return false
    })
</script>

<style lang="less">
    body {
        font-family: Helvetica Neue, Helvetica, PingFang SC;
        line-height: 1.5;
        color: #515a6e;
        background-color: #f7f7f7;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
</style>
